package com.bite.order.controller;


import com.bite.api.ProductInteface;
import com.bite.model.ProductInfo;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("feign")
@RestController
public class TestFeignController {
    @Autowired
    ProductInteface productInteface;

    @RequestMapping("/o1")
    public String o1(Integer id, String userName, HttpServletResponse response) {
        response.setStatus(502);
        log.info(id + userName);
        return id + userName;
    }

    @RequestMapping("/o2")
    public String o2(Integer id, String name) {
        return productInteface.p2(id, name);
    }

    @RequestMapping("/o3")
    public String o3(ProductInfo productInfo) {
        return productInteface.p3(productInfo);
    }

    @RequestMapping("/o4")
    public String o4(@RequestBody ProductInfo productInfo) {
        System.out.println(productInfo.toString());
        return productInteface.p4(productInfo);
    }


}
